﻿using System.IO;
using System.Windows;
using System.Windows.Controls;
using Zeus.Classes.Documents;
using System.IO.IsolatedStorage;
using System.Windows.Media;

namespace Zeus.Classes.Engines.Sound_Engine
{
    public partial class EditorSound : UserControl
    {
        public EditorSound(Document soundDoc)
        {
            InitializeComponent();
            IsolatedStorageFile isolated = IsolatedStorageFile.GetUserStoreForApplication();
            
            IsolatedStorageFileStream isolatedStorageFileStream = isolated.OpenFile(soundDoc.FilePath, FileMode.Open,FileAccess.Read);
            
            media.SetSource(isolatedStorageFileStream);
            silder_1.Value = 100;

        }
        public EditorSound()
        {
            InitializeComponent();
        }

        private void ButtonPlayClick(object sender, RoutedEventArgs e)
        {
            media.Play();
        }

        private void ButtonStopClick(object sender, RoutedEventArgs e)
        {
            media.Stop();
        }

        private void ButtonPauseClick(object sender, RoutedEventArgs e)
        {
            media.Pause();
        }

        private void silder_1_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            media.Volume = silder_1.Value;
        }

        private void Mute_Click(object sender, RoutedEventArgs e)
        {
            media.Volume = 0;
            silder_1.Value = 0;
        }


    }
}
